﻿using System;
using System.Windows;
using Bookvar.UI.DragDrop.Actions;

namespace Bookvar.UI.DragDrop
{
    public class MindmapPanelDropTargetAdvisor : DropTargetAdvisorBase
    {
        public override bool IsValidDataObject( IDataObject obj )
        {
            return
                obj.GetDataPresent( BookvarDataFormats.Topic.Name ) ||
                obj.GetDataPresent( DataFormats.FileDrop ) ||
                obj.GetDataPresent( BookvarDataFormats.ImageInfo.Name ) ||
                obj.GetDataPresent( BookvarDataFormats.LiveImageInfo.Name );
        }

        public override void OnDropCompleted( DragEventArgs args, Point dropPoint )
        {
            DropActionBase action = ActionFactory.CreateDropAction( args );
            action.Execute( args, (MindMapPanel) TargetElement, dropPoint );
        }
    }
}
